package com.czk.server.handler;

import com.czk.domain.MsgDemo1;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * MsgDemo1的消息处理器
 *
 * @Author:ChenZhangKun
 * @Date: 2021/4/30 10:54
 */
public class MyMsgDemo01Handler extends SimpleChannelInboundHandler<MsgDemo1> {
    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, MsgDemo1 msgDemo1) throws Exception {
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + " 接收消息的处理器：" + this.getClass().getName());
        System.out.println("channelId：" + msgDemo1.getChannelId());
        System.out.println("消息内容：" + msgDemo1.getDemo1());
    }
}
